home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
SYMBMATH.H07
< prev
next >
Wrap
Text File
|
1994-03-29
|
1KB
|
21 lines
3.1.5.6 Procedures
A procedure is similar to a function, but the right side of
assigment in its definition is multi statements grouped by block().
The block(a,b,c) groups a,b,c and only returns the last arguement as its
value, or returns the second last arguement as its value if the last
arguement is local(). It is used as grouper in definition of a procedure.
All variables in block are global, except for variables declared by
local().
e.g. f(x_):=block(p:=x^6,p,local(p))
Remember that you can split a line of program into multi-lines
program at comma ,.
3.1.5.7 Rules
A rule is similar to a function. In definition of function, all
arguements of function are simple variables, but in definition of rules,
the first arguement may be a complicated expression.
e.g.
f(x_,y_) := x^2+y^2 # defining function
f(x_,y_) := block(a:=2, a+x^2+y) # defining procedure
log(x_ * y_) := log(x)+log(y) # defining rule